import { versions,versionsNew} from './validate'

var validateVersion = (rule, value, callback) => {
  if (value == "" || !value) {
    callback(new Error("请输入版本号"));
  } else {
    if (versions(value)) {
      callback();
    } else {
      callback(new Error("格式请以V开头例如为（V1-V99） 或 (V1.0-V99.99)"));
    }
  }
};
var validateVersionNew = (rule, value, callback) => {
  if (value == "" || !value) {
    callback(new Error("请输入版本号"));
  } else {
    if (versionsNew(value)) {
      callback();
    } else {
      callback(new Error("格式请以ST开头,最多16字符)"));
    }
  }
};

export default {
  version: [{ required: true, trigger: "blur", validator: validateVersion }],
  versionNew: [{ required: true, trigger: "blur", validator: validateVersionNew }],
};
